package com.niiwoo.civet.system.service.local;

import com.niiwoo.civet.system.dao.entity.SmsTemplate;
import com.niiwoo.civet.system.dao.mapper.SmsTemplateMapperExt;
import com.niiwoo.civet.system.dto.common.MessageTemplateDto;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by dell on 2017/12/11.
 * Description：civet-parent
 */
@Service
public class SysMessageLocalService {

    @Autowired
    private SmsTemplateMapperExt smsTemplateMapperExt;


    /**
     * 根据 templateCode 查询模板
     * @param templateCode
     * @return
     */
    public MessageTemplateDto selectByTemplateCode(String templateCode){
        SmsTemplate smsTemplate = smsTemplateMapperExt.selectByTemplateCode(templateCode);
        MessageTemplateDto messageTemplateDto = new MessageTemplateDto();
        BeanUtils.copyProperties(smsTemplate, messageTemplateDto);
        return messageTemplateDto;
    }
}
